package com.xinzhi.controller;

import com.xinzhi.pojo.OneGradeIndex;
import com.xinzhi.pojo.TwoGradeIndex;
import com.xinzhi.pojo.dto.AddJiaQin;
import com.xinzhi.pojo.dto.Yiji;
import com.xinzhi.service.*;
import com.xinzhi.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class ReasonController {


    @Autowired
    private OneGradeService oneGradeService;
    @Autowired
    private LfaService lfaService;
    @Autowired
    private TwoGradeIndexService twoGradeIndexService;
    @Autowired
    private QianshouService qianshouService;


    /**
     * 指标框架制定的查询接口
     * @return
     */
    @GetMapping("/getAll")
    public List<Yiji> getAll(){
        return oneGradeService.getAll();
    }






    /**
     * 指标框架制定的删除接口
     * @return
     */

//指标框架制定的逻辑删
    @PostMapping("/lynupdatese")
    public Result lynupdatese(String two_index) {
        return lfaService.lynupdatess(two_index);
    }




    /**
     * 指标框架制定的修改接口
     */

    @PostMapping("/updateTwoGradeIndex")
    public Result update(@RequestParam Integer two_indexid, @RequestParam String two_index){
        Result update = twoGradeIndexService.update(two_indexid,two_index);
            return update;
    }



    /**
     * 指标框架制定的新增接口
     */

    @PostMapping("/addQianshou")
    public Result addQianshou(@RequestBody AddJiaQin addJiaQin){
        Result result = qianshouService.addQianshou(addJiaQin);
        return Result.ok(result);
    }



    /**
     * 指标框架制定的下发修改状态接口
     *
     */

    @PostMapping("/updateState")
    public Result updateState(String two_index){
        return twoGradeIndexService.updateState(two_index);
    }


}

